/*
 * @Descripttion:
 * @version:
 * @Author: ChenXiang
 * @Date: 2021-07-10 12:02:05
 * @LastEditors: ChenXiang
 * @LastEditTime: 2021-08-14 10:32:53
 */
import React, { FC } from "react";
import "./index.scss";

interface AutoTextProps {
  type?: "scroll" | "middle";
  text: string;
  width?: number;
}
export const AutoText: FC<AutoTextProps> = (props) => {
  const { text, width, type } = props;

  return (
    <div style={{ width }} className={`auto-${type}-text`}>
      <p className="wrap">
        <span className="txt">{text}</span>
        <span className="title" data-title={text}>
          {text}
        </span>
      </p>
    </div>
  );
};

AutoText.defaultProps = {
  type: "scroll",
  width: 300,
};

export default AutoText;
